﻿@page "/RazorPage/LaunchVerify/EmailTemplate/{formid:int?}"
@model RndMaterialDisposalService.Pages.EmailTemplates.LaunchVerify.IndexModel;
@using System.Text.Json;
@using System.Text.Json.Nodes;

@{
    Layout = "~/Pages/Shared/_EmailLayout.cshtml";
    int idx = 0;
    var jsonArray = Model.FormData["erpDeviceInfo"]?.AsArray() ?? new JsonArray();
}

<table style="width: 100%; border-spacing: 0; border-collapse: collapse; font-family: 宋体; font-size: 10pt;">
    <tr style="background-color: #B8B8B8; color: black; font-size: 11pt; font-weight: bold;">
        <td colspan="4">申请信息</td>
    </tr>
    <tr>
        <td style="font-weight: Bold;width: 20%;">是否中试批:</td>
        <td style="width: 30%;">@(Model.FormData["pilotPlantTest"]?.GetValue<bool>()==true ?"是":"否")</td>
        <td style="font-weight: Bold;width: 20%;">中试申请单</td>
        <td style="width: 30%;">@(Model.FormData["orginFolio"]?.GetValue<string>() ?? "")</td>
    </tr>
    <tr>
        <td style="font-weight: Bold;width: 20%;">填表人:</td>
        <td style="width: 30%;">@(Model.FormData["applicant"]?.GetValue<string>() ?? "")</td>
        <td style="font-weight: Bold;width: 20%;">产品线:</td>
        <td style="width: 30%;">@(Model.FormData["productLine"]?.GetValue<string>() ?? "")</td>
    </tr>
    <tr>
        <td style="font-weight: Bold;width: 20%;">项目名称:</td>
        <td style="width: 30%;">@(Model.FormData["projectName"]?.GetValue<string>() ?? "")</td>
        <td style="font-weight: Bold;width: 20%;">财务编码:</td>
        <td style="width: 30%;">@(Model.FormData["projectCode"]?.GetValue<string>() ?? "")</td>
    </tr>
    <tr>
        <td style="font-weight: Bold;width: 20%;">验证地点:</td>
        <td style="width: 30%;">@(Model.FormData["productAddress"]?.GetValue<string>() ?? "")</td>
        <td style="font-weight: Bold;width: 20%;">产品型号:</td>
        <td style="width: 30%;">@(string.Join(";", Model.FormData["productModelNumber"]?.AsArray() ?? new JsonArray()))</td>
    </tr>
    <tr>
        <td style="font-weight: Bold;width: 20%;">验证批次:</td>
        <td style="width: 30%;">@(Model.FormData["batchNumber"]?.GetValue<string>() ?? "")</td>
        <td style="font-weight: Bold;width: 20%;"></td>
        <td style="width: 30%;"></td>
    </tr>
    <tr>
        <td style="font-weight: Bold;width: 20%;">项目计划开始日期:</td>
        <td style="width: 30%;">@(Model.FormData["projectStartDate"]?.GetValue<DateTime>().ToString("yyyy-MM-dd") ?? "")</td>
        <td style="font-weight: Bold;width: 20%;">项目计划完成日期:</td>
        <td style="width: 30%;">@(Model.FormData["projectEndDate"]?.GetValue<DateTime>().ToString("yyyy-MM-dd") ?? "")</td>
    </tr>
    <tr>
        <td style="font-weight: Bold;width: 20%;">项目经理:</td>
        <td style="width: 30%;">@(Model.FormData["projectManager"]?.GetValue<string>() ?? "")</td>
        <td style="font-weight: Bold;width: 20%;">试制组长:</td>
        <td style="width: 30%;">@(Model.FormData["trialGroupLeader"]?.GetValue<string>() ?? "")</td>
    </tr>

    
    <tr style="background-color: #B8B8B8; color: black; font-size: 11pt; font-weight: bold;">
        <td colspan="4">验证涉及产品范围</td>
    </tr>
    @foreach (JsonObject item in jsonArray)
    {
        <tr>
            <td style="font-weight: Bold;width: 20%;">【# @(idx += 1)】 描述:</td>
            <td colspan="3">@(item?["describe"]?.GetValue<string>() ?? "")</td>
        </tr>
        <tr>
            <td style="font-weight: Bold;width: 20%;">对内型号:</td>
            <td style="width: 30%;">@(item?["intMod"]?.GetValue<string>() ?? "")</td>
            <td style="font-weight: Bold;width: 20%;">对外型号:</td>
            <td style="width: 30%;">@(item?["extMod"]?.GetValue<string>() ?? "")</td>
        </tr>
        <tr>
            <td style="font-weight: Bold;width: 20%;">编码:</td>
            <td style="width: 30%;">@(item?["itemID"]?.GetValue<string>() ?? "")</td>
            <td style="font-weight: Bold;width: 20%;">验证数量:</td>
            <td style="width: 30%;">@(item?["verifyNum"]?.GetValue<int>())</td>
        </tr>
    }
</table>